package com.enterprise.viewer.server;

import com.enterprise.viewer.client.EnterpriseViewerServiceManager.EnterpriseViewerService;
import com.enterprise.viewer.shared.contentproviders.ContentProvider;
import com.enterprise.viewer.shared.contentproviders.ContentProviderCategory;
import com.enterprise.viewer.shared.contentproviders.ContentProviders;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;


/**
 * The server side implementation of the RPC service.
 */
@SuppressWarnings("serial")
public class EnterpriseViewerServiceImpl extends RemoteServiceServlet implements EnterpriseViewerService {

	@Override
	public ContentProviders getContentProviders()throws IllegalArgumentException {
		return createSampleProviders();
	}

	@Override
	public ContentProviders getServices() throws IllegalArgumentException {
		return createSampleServices();
	}

	private ContentProviders createSampleProviders() {
		ContentProviders contentproviders = new ContentProviders();
		
		ContentProviderCategory category = new ContentProviderCategory("NRAO");
		category.add(new ContentProvider("www.nrao.edu/", "Homepage", "Radio astronomy reveals the hidden universe"));
		category.add(new ContentProvider("www.nrao.edu/index.php/about/facilities", "Research Facilities", "The NRAO operates a complementary suite of powerful telescopes for exploring the Universe"));
		category.add(new ContentProvider("www.nrao.edu/index.php/learn/gbsc", "Science Center", "The Green Bank Science Center has something for everyone: interactive exhibits about science and technology, fun programs and activities, and outstanding tours of the Robert C. Byrd Green Bank Telescope"));
		contentproviders.add(category);		

		category = new ContentProviderCategory("Space Needle");
		category.add(new ContentProvider("www.spaceneedle.com//", "Homepage", "Radio astronomy reveals the hidden universe"));
		category.add(new ContentProvider("www.spaceneedle.com/visit-the-needle/observation-deck/", "Observation Deck", "Space Needle View: One place to see every place"));
		category.add(new ContentProvider("www.spaceneedle.com/skycity-restaurant/", "SkyCity Restaurant", "Revolutionary dining atop Seattle.  Everything here is fresh, the food, the conversation, even the view! Yes, the entire restaurant moves 360 degrees allowing you to take in each course of the city as you take in each delicious course of your meal. Try the Lunar Orbiter dessert served up since 1962. Just don’t lick it!"));
		contentproviders.add(category);

		category = new ContentProviderCategory("Google");
		category.add(new ContentProvider("www.google.com", "Google", "a sample content provider"));
		category.add(new ContentProvider("www.google.com/maps", "Google Maps", "a sample content provider"));
		category.add(new ContentProvider("www.google.com/gmail", "GMail", "a sample content provider"));
		contentproviders.add(category);

		return contentproviders;
	}	

	private ContentProviders createSampleServices() {
		ContentProviders contentproviders = new ContentProviders();

		ContentProviderCategory category = new ContentProviderCategory("PowerPoint Export");
		contentproviders.add(category);
		
		category = new ContentProviderCategory("Excel Export");
		contentproviders.add(category);		

		category = new ContentProviderCategory("Alerts");
		contentproviders.add(category);

		category = new ContentProviderCategory("Preferences");
		contentproviders.add(category);

		return contentproviders;
	}	
}
